//
//  SearchMessageEngine.m
//  HuLaQuan
//
//  Created by liyan on 16/1/27.
//  Copyright © 2016年 yuwubao. All rights reserved.
//

#import "SearchMessageEngine.h"

@implementation SearchMessageEngine

-(void)searchMessage:(NSString *)userId
{
    
    NSString *src = [NSString stringWithFormat: @"<?xml version=\"1.0\" encoding=\"UTF-8\"?><msg service=\"QueryMessage\" userId=\"%@\"></msg>",[CurrentUser sharedInstance].ID];
    //
    NSLog(@"%@ -- src --- ",src);
    
    //use Yu
    [YuHTTPClient XMLFMDataWithUrl:FM_SERVER_HOST parameters:src success:^(BOOL isSuccess, id item){
        
        NSDictionary *result;
        if (isSuccess) {
            result = @{@"isSuccess":@YES,@"result":item};
        }else{
            result = @{@"isSuccess":@NO,@"message":item};
        }
        //
        [[NSNotificationCenter defaultCenter] postNotificationName:@"SearchMessageFinish" object:result];
    }];
    
}

@end
